package com.tqfframe.task.task;

import com.tqfframe.core.biz.model.ReturnT;
import com.tqfframe.core.handler.annotation.XxlJob;
import com.tqfframe.core.log.XxlJobLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 *
 *  通过fegin去调用其他项目进行调度。 12
 *
 * Created by Tang-QiFeng on 2020/7/8
 */
@Component
public class FristxxJobTest {
    private static Logger logger = LoggerFactory.getLogger(FristxxJobTest.class);

    /**
     * 1、简单任务示例（Bean模式）
     */
    @XxlJob("demoJobHandler")
    public ReturnT<String> demoJobHandler(String param) throws Exception {
        XxlJobLogger.log("XXL-JOB, Hello World.");
        logger.info("我进来了");
        for (int i = 0; i < 5; i++) {
            XxlJobLogger.log("beat at:" + i);
            TimeUnit.SECONDS.sleep(2);
        }
//        Thread.currentThread().sleep(1000);
        return ReturnT.SUCCESS;
    }

}
